<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8">
<title>监控参数定时配置 | 编辑</title>
<@fm.header />
</head>
<body>
<div class="easyui-layout" style="text-align: center; height: 270px;" fit="true">
	<div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
	<form id="ff" method="post" action="/monitor/param/timing/${monitorParam.id}/update">
	    <table>
	        <tr>
	            <td><label for="param">参数:</label></td>
	            <td><input class="easyui-validatebox" type="text" name="param" value="${monitorParam.param}" data-options="required:true"></input></td>
	        </tr>
	        <tr>
	            <td><label for="executeTime">执行时间:</label></td>
	            <td><input type="text" class="easyui-datetimebox" id="executeTime" name="executeTime" /></td>
	        </tr>
	        <tr>
	            <td><label for="value">值:</label></td>
	            <td><input class="easyui-validatebox" type="text" name="value" value="${monitorParam.value}"  data-options="required:true"></input></td>
	        </tr>
	        <input type="hidden" name="isExecute" id="isExecute" value="${monitorParam.isExecute}" >
	        <input type="hidden" name="executeTimeHidden" id="executeTimeHidden" value="${monitorParam.executeTime}" >
	    </table>
	</form>
	</div>
	<div region="south" border="false" style="text-align: center; padding: 5px 5px 5px 0;">
	    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submit()">提交</a>
	    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">重置</a>
	</div>
</div>
<script>
$(function(){
	$('#executeTime').datetimebox('setValue', '${monitorParam.executeTime}');
})

function submit() {
	var executeTime = $('#executeTime').datetimebox('getValue');
	executeTime = executeTime.replace("-","/");
	executeTime = new Date(Date.parse(executeTime));
	var date = new Date();
	if (executeTime<date) {
		alert("执行时间不能小于当前时间！");
		return false;
	}
	$("#ff").form('submit', {
		//url : '/monitor/param/timing/${monitorParam.id}/update',
		onSubmit : function() {
			var flag = $(this).form('validate');
			if (flag) {
				showProcess(true, market.content.title, market.content.submitting);
			}
			return flag;
		},
		success : function(data) {
			showProcess(false);
			var data = eval('(' + data + ')');
			if (data.return_code == '1') {
				top.showMsg(market.content.title, data.return_msg, alert);
				if (parent !== undefined) {
					if ($.isFunction(parent.reloadParent)) {
						parent.reloadParent.call();
						parent.closeMyWindow();
					} else {
						parent.$("#tt").datagrid('reload');
						parent.closeMyWindow();
					}
				}
			} else {
				$.messager.alert(market.content.title, data.return_msg);
			}
		},
		onLoadError : function() {
			showProcess(false);
			$.messager.alert(market.content.title, market.content.networkError);
		}
	});
}
</script>
</body>
</html>